<%@ include file="/common/taglibs.jsp"%>

<%@page import="java.net.URLEncoder"%>
<title><fmt:message key="personDetail.title"/></title>
<content tag="heading"><fmt:message key="personDetail.heading"/></content>

<spring:bind path="person.*">
    <c:if test="${not empty status.errorMessages}">
    <div class="error">
        <c:forEach var="error" items="${status.errorMessages}">
            <img src="<c:url value="/images/iconWarning.gif"/>"
                alt="<fmt:message key="icon.warning"/>" class="icon" />
            ${error}<br />
        </c:forEach>
    </div>
    </c:if>
</spring:bind>

<script type="text/javascript">
  function postPaypal()
  {
	$('paypalForm').submit();
	return false;
  }
</script>
<div style="display:none">
<form id="paypalForm" action="https://www.paypal.com/cgi-bin/webscr">
	<input type="hidden" name="cmd" value="_xclick"/>
	<input type="hidden" name="business" value="admin@islamiccenterofnaperville.org"/>
	<input type="hidden" name="no_shipping" value="1"/>
	<input type="hidden" name="return" value="http://www.IslamicCenterofNaperville.org/	"/>
	<input type="hidden" name="currency_code" value="USD"/>
	<input type="hidden" name="tax" value="0"/>
	<input type="hidden" name="bn" value="PP-DonationsBF"/>
	<input type="hidden" name="item_name" value="Membership"/>
	<input type="hidden" name="amount" value="100.00"/>
</form>
</div>

<h1><a href="#" onclick="postPaypal();" style="font-size: 16pt; font-decoration: underline; color: blue">>>> Click here to pay your Membership dues online <<<</a></h1>
<c:if test="${person.personId != null && person.primaryPerson }">
	<display:table name="person.memberInformations" cellspacing="0" cellpadding="0" requestURI=""
	    id="membershipList" pagesize="25" class="table personList" export="false" defaultsort="1">
	    <display:column property="yearOfMembership" escapeXml="true" sortable="true"
	         titleKey="memberInformation.yearOfMembership"/>
	    <display:setProperty name="paging.banner.item_name" value="Paid Membership"/>
	    <display:setProperty name="paging.banner.items_name" value="Paid Memberships"/>
		<display:caption>This table lists all the years when you had a paid membership.</display:caption>
	</display:table>
</c:if>

<c:import url="personFormCommonRestricted.jsp"/>

<c:if test="${person.personId != null && person.primaryPerson }">
	<%
		pageContext.setAttribute("passKeyEncoded", URLEncoder.encode(request.getParameter("passKey"),"UTF-8"));
	%>
 	<input type="button" value="Add Dependents"
 		name="addRelationship" onclick="javascript:location.href='editRelationshipRestricted.html?passKey=${pageScope.passKeyEncoded}&primaryPersonId=${person.personId}';"/>

	<display:table name="person.personRelations" cellspacing="0" cellpadding="0" requestURI=""
	    id="personList" pagesize="25" class="table personList" export="false">

	<display:column titleKey="person.personId" sortable="true" sortProperty="relatedPerson.personId">
         	<c:set var="editurl" value="editRelationshipRestricted.html?passKey=${pageScope.passKeyEncoded}&primaryPersonId=${personList.person.personId}&personId=${personList.relatedPerson.personId}"/>
         <a href="${editurl}">${personList.relatedPerson.personId}</a>
	</display:column>
	    <display:column property="relationshipType.relationshipType" escapeXml="true" sortable="true" sortProperty="relationshipType.relationshipType"
	         titleKey="person.relationshipType">
		</display:column>
	    <display:column property="relatedPerson.firstName" escapeXml="true" sortable="true"
	         titleKey="person.firstName"/>
	    <display:column property="relatedPerson.lastName" escapeXml="true" sortable="true"
	         titleKey="person.lastName"/>
	    <display:column property="relatedPerson.email" escapeXml="true" sortable="true"
	         titleKey="person.email"/>
	    <display:column property="relatedPerson.email2" escapeXml="true" sortable="true"
	         titleKey="person.email2"/>
	    <display:column property="relatedPerson.phoneHome" escapeXml="true" sortable="true"
	         titleKey="person.phoneHome"/>
	    <display:column property="relatedPerson.phoneWork" escapeXml="true" sortable="true"
	         titleKey="person.phoneWork"/>
	    <display:column property="relatedPerson.phoneMobile" escapeXml="true" sortable="true"
	         titleKey="person.phoneMobile"/>
	    <display:column property="relatedPerson.phoneFax" escapeXml="true" sortable="true"
	         titleKey="person.phoneFax"/>
	    <display:setProperty name="paging.banner.item_name" value="person"/>
	    <display:setProperty name="paging.banner.items_name" value="persons"/>
	</display:table>


</c:if>

<script type="text/javascript">
    document.personForm.firstName.focus();
    highlightTableRows("personList");
</script>

<v:javascript formName="person" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
<script type="text/javascript"  src="<c:url value="/scripts/validator.jsp"/>"></script>
